package com.leoman.spinningmachine.tab1;

import android.content.Context;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.leoman.helper.adapter.BaseRecyclerAdapter;
import com.leoman.helper.util.FrescoUtil;
import com.leoman.spinningmachine.R;
import com.leoman.spinningmachine.bean.RmhdBean;
import com.leoman.spinningmachine.util.DateUtil;

import java.util.List;

import static com.leoman.spinningmachine.constant.Urls.INDEX_URL;

/**
 * Created by Administrator on 2018/4/24.
 * 热门活动
 */

public class HotAdapter extends BaseRecyclerAdapter<RmhdBean> {

    private Context mContext;
    public HotAdapter(Context context,int layoutResId, List<RmhdBean> data) {
        super(layoutResId, data);
        this.mContext = context;
    }

    @Override
    protected void bindTheData(BaseViewHolder holder, RmhdBean bean, int position) {
        SimpleDraweeView simpleDraweeView = holder.findViewById(R.id.iv_pic);
        TextView tvTitle = (TextView) holder.findViewById(R.id.tv_news_title);
        TextView tvTime = (TextView) holder.findViewById(R.id.tv_time);
        TextView tvPeople = (TextView) holder.findViewById(R.id.tv_people);

        FrescoUtil.setImg(mContext,simpleDraweeView,INDEX_URL+bean.getImage());
        tvTitle.setText(""+bean.getTitle());
        tvTime.setText(""+ DateUtil.getyMdStr(bean.getCreateDate()));
        tvPeople.setText(""+bean.getViewNum());
    }
}
